/*
 * @Author: WangShuai 1830773767@qq.com
 * @Date: 2025-05-12 18:21:06
 * @LastEditors: WangShuai 1830773767@qq.com
 * @LastEditTime: 2025-05-12 19:36:02
 * @FilePath: \cesium_visualBasic\src\utils\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import * as Cesium from'cesium'
//更新3dtiles的模型矩阵
export const update3dtilesMaxtrix = (tx,ty,tile)=>{
 const center =tile.boundingSphere.center;
 //获取以当前模型位远点的垂直于当前地表的垂直坐标系
 const m = Cesium.Transforms.eastNorthUpToFixedFrame(center);
 //x,y,z三个方向上的偏移值
 const _tx = tx? tx:0;
 const _ty = ty? ty:0;
 const _tz= 0;
 const tempTranslation = new Cesium.Cartesian3(_tx,_ty,_tz);
 //计算模型远点与偏移坐标的方向向量 offset是偏移之后的点, translation是方向向量
 const offset = Cesium.Matrix4.multiplyByPoint(m,tempTranslation,new Cesium.Cartesian3(0,0,0));
 const translation = Cesium.Cartesian3.subtract(offset,center,new Cesium.Cartesian3());
 //通过方向向量,计算进行的模型矩阵
 tile.modelMatrix = Cesium.Matrix4.fromTranslation(translation);

}